<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
</head>
<body>
	<p>
		<span></span>年
	</p>
	<p>
		<span></span>月
	</p>
	<p>
		<span></span>日
	</p>
	<p>
		<span></span>时
	</p>
	<p>
		<span></span>分
	</p>
	<p>
		<span></span>秒
	</p>

<script type="text/javascript">

function render(){
	//获取当前时间 返回中国标准时间
	let date = new Date()
	console.log(date)

	let year = date.getFullYear() //2025 获取年份
	let month = date.getMonth()+1 //0-11月份  手动＋1
	let day = date.getDate() //16 返回日期 1 - 31
	let hour = date.getHours() //返回0-23小时
	let minute = date.getMinutes() //返回0-59分钟
	let second = date.getSeconds()//秒 0 -59秒
	let millisecond = date.getMilliseconds()//毫秒 0 -999
	console.log(year,month,day,hour,minute,second,millisecond)
	let spans = document.querySelectorAll('span')
		spans[0].innerText = year
		spans[1].innerText = month
		spans[2].innerText = day
		spans[3].innerText = hour
		spans[4].innerText = minute
		spans[5].innerText = second
	}
	render()
	setInterval(render,1000)
	

</script>
</body>
</html>